#include <stdio.h>
#define MAX 10

void print(char what[], int a[], int n) {
    int i;
    printf("%s: ", what);
    for (i = 0; i < n; i++) {
        printf("%d ", a[i]);
    }
    printf("\n");
}

int find(int a[], int n, int key) {
    int i, found = 0;
    for (i = 0; i < n; i++) {
        if (a[i] == key) {
            found = 1;
            break;
        }
    }
    return found;
}

void input(int a[], int n) {
    int i, num;
    for (i = 0; i < n; i++) {
        scanf("%d", &num);
        if (!find(a, i + 1, num)) {
            a[i] = num;
        } else {
            i--;
        }
    }
}

int getUnion(int a[], int b[], int n, int uset[]) {
    int i, size = 0;
    for (i = 0; i < n; i++) {
        uset[size++] = a[i];
    }
    for (i = 0; i < n; i++) {
        if (!find(a, n, b[i])) {
            uset[size++] = b[i];
        }
    }
    return size;
}

int getCross(int a[], int b[], int n, int cset[]) {
    int i, size = 0;
    for (i = 0; i < n; i++) {
        if (find(b, n, a[i])) {
            cset[size++] = a[i];
        }
    }
    return size;
}

int getMinus(int a[], int b[], int n, int mset[]) {
    int i, size = 0;
    for (i = 0; i < n; i++) {
        if (!find(b, n, a[i])) {
            mset[size++] = a[i];
        }
    }
    return size;
}

int main() {
    //input
    int a[MAX], b[MAX];
    int uset[MAX * 2], cset[MAX], mset[MAX];
    int usize, csize, msize;

    input(a, MAX);
    input(b, MAX);
    
    print("Array A", a, MAX);
    print("Array B", b, MAX);

    //union
    //int a[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
    //int b[] = {0, 11, 2, 33, 4, 55, 6, 7, 8, 9};

    usize = getUnion(a, b, MAX, uset);
    print("Union Set", uset, usize);
    //cross
    csize = getCross(a, b, MAX, cset);
    print("Cross Set", cset, csize);
    //minus
    msize = getMinus(a, b, MAX, mset);
    print("Minus Set", mset, msize);

    return 0;
}
